package com.zhuhjay.eduservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhuhjay.commonutils.R;
import com.zhuhjay.eduservice.entity.EduSubject;
import com.zhuhjay.eduservice.entity.subject.SubjectItem;
import com.zhuhjay.eduservice.service.EduSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author ZhuHJay
 * @since 2022-09-06
 */
@Api(description = "课程科目控制器")
@RestController
@RequestMapping("/eduservice/subject")

public class EduSubjectController {

    @Resource
    private EduSubjectService subjectService;

    @ApiOperation(value = "添加课程信息")
    @PostMapping("addSubject")
    public R addSubject(MultipartFile file) {
        subjectService.saveSubject(file);
        return R.ok();
    }

    @ApiOperation(value = "查询所有课程信息，一级分类和二级分类")
    @GetMapping("getAllSubject")
    public R getAllSubject() {
        return R.ok().data("list", subjectService.getAllSubjectItems());
    }

}

